<template>
  <!-- 右边按钮 -->
  <div>
    <!-- 男款女款按钮区 -->
    <div class="rightTopBtn">
      <!-- 男款按钮区 -->
      <div class="modleBtn">
        <img
          src="../images/man.png"
          alt="男款"
          width="100%"
          :class="manStyle.imgStyle"
          @click="manClick"
        />
        <span :class="manStyle.spanStyle">男款</span>
      </div>
      <!-- 女款按钮区 -->
      <div class="modleBtn">
        <img
          src="../images/women.png"
          alt="女款"
          width="100%"
          :class="womenStyle.imgStyle"
          @click="womenClick"
        />
        <span :class="womenStyle.spanStyle">女款</span>
      </div>
    </div>
    <!-- 3D透视按钮区 -->
    <div class="rightBottomBtn">
      <div class="modleBtn">
        <img src="../images/perspective3d.png" alt="3D透视" width="100%" @click="perspectiveClick"/>
        <span>3D透视</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "rightBtn",
  data() {
    return {
      // 当前加载的模型,true为男款
      nowModel: true,
      // 男款样式
      manStyle: {
        imgStyle: "clickBtnImg",
        spanStyle: "clickBtnSpan",
      },
      // 女款样式
      womenStyle: {
        imgStyle: "",
        spanStyle: "",
      },
    };
  },
  methods: {
    // 点击男款
    manClick() {
      //如果当前加载的是女款模型
      if (!this.nowModel) {
        // 清除女款点击按钮样式
        this.womenStyle.imgStyle = "";
        this.womenStyle.spanStyle = "";
        // 添加男款点击按钮样式
        this.manStyle.imgStyle = "clickBtnImg";
        this.manStyle.spanStyle = "clickBtnSpan";
        console.log("加载男款模型");
        // 取反
        this.nowModel = !this.nowModel;
      }
    },
    // 点击女款
    womenClick() {
      //如果当前加载的是男款模型
      if (this.nowModel) {
        // 清除男款点击按钮样式
        this.manStyle.imgStyle = "";
        this.manStyle.spanStyle = "";
        // 添加女款点击按钮样式
        this.womenStyle.imgStyle = "clickBtnImg";
        this.womenStyle.spanStyle = "clickBtnSpan";
        console.log("加载女款模型");
        // 取反
        this.nowModel = !this.nowModel;
      }
    },
    // 点击3d透视
    perspectiveClick(){
      console.log("3d透视");
    }
  },
};
</script>

<style lang="less" scoped>
.rightTopBtn {
  position: absolute;
  width: 14.3%;
  height: auto;
  right: 4%;
  top: 14%;
  //   background-color: pink;
  .modleBtn {
    width: 100%;
    margin-bottom: 0.625rem;
    height: 50%;
    // background-color: purple;
    display: flex;
    align-items: center;
    flex-direction: column;
    img {
      background-color: white;
      border-radius: 0.625rem;
    }
    span {
      // display: inline-block;
      // margin-top: 0.125rem;
      font-size: 0.875rem;
    }
  }
}

.rightBottomBtn {
  position: absolute;
  width: 14.3%;
  height: auto;
  right: 4%;
  top: 54%;
  display: flex;
  justify-content: center;

  // background-color: pink;
  .modleBtn {
    width: 75%;
    height: 50%;
    // background-color: purple;
    // display: flex;
    // align-items: center;
    // flex-direction: column;
    span {
      // display: inline-block;
      font-size: 0.875rem;
      white-space: nowrap;
      color: #5d000b;
      font-weight: bold;
    }
  }
}

.clickBtnImg {
  border: solid 1px #fc7867;
}
.clickBtnSpan {
  color: #fc7867;
}
</style>